lib/sign: allow to build with glib version less than 2.44
authorDenis Pynkin <denis.pynkin@collabora.com>
Mon, 18 Nov 2019 23:44:16 +0000 (02:44 +0300)
committerDenis Pynkin <denis.pynkin@collabora.com>
Wed, 25 Mar 2020 12:23:54 +0000 (15:23 +0300)
Ubuntu 14.04 uses glib-2.40 which have no some shiny macroses
for interface declaration.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
src/libostree/ostree-autocleanups.h
src/libostree/ostree-sign-dummy.c
src/libostree/ostree-sign-dummy.h
src/libostree/ostree-sign-ed25519.c
src/libostree/ostree-sign-ed25519.h
src/libostree/ostree-sign.c
src/libostree/ostree-sign.h
src/libostree/ostree.h

index c9692ebeba87857e63246303a9bc8b8ab0090872..14017012774f9da50b6d1691eb54ddbf3240dd15 100644 (file)
@@ -73,6 +73,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderOverride, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderResult, ostree_repo_finder_result_free)
 G_DEFINE_AUTO_CLEANUP_FREE_FUNC (OstreeRepoFinderResultv, ostree_repo_finder_result_freev, NULL)
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeSign, g_object_unref)
 #endif
 
 G_END_DECLS
index e2d1fe56dc50ad7f9ffeaeec81393f5dcf9f8ea3..48190149f22f16d43b1448e011c7809c8502508f 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "config.h"
 
+#include <libglnx.h>
 #include "ostree-sign-dummy.h"
 #include <string.h>
 
@@ -43,6 +44,10 @@ struct _OstreeSignDummy
   gchar *signature_ascii;
 };
 
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeSignDummy, g_object_unref)
+#endif
+
 static void
 ostree_sign_dummy_iface_init (OstreeSignInterface *self);
 
index a0d10e1da3b6ec6a087f4c2dc0bece866e21e677..f80f8682ca83b1929ecb8aa1ef2b8cac53cffdf9 100644 (file)
@@ -32,12 +32,26 @@ G_BEGIN_DECLS
 
 #define OSTREE_TYPE_SIGN_DUMMY (ostree_sign_dummy_get_type ())
 
+_OSTREE_PUBLIC
+GType ostree_sign_dummy_get_type (void);
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+typedef struct _OstreeSignDummy OstreeSignDummy;
+typedef struct { GObjectClass parent_class; } OstreeSignDummyClass;
+
+static inline OstreeSignDummy *OSTREE_SIGN_DUMMY (gpointer ptr) { return G_TYPE_CHECK_INSTANCE_CAST (ptr, ostree_sign_dummy_get_type (), OstreeSignDummy); }
+static inline gboolean OSTREE_IS_SIGN_DUMMY (gpointer ptr) { return G_TYPE_CHECK_INSTANCE_TYPE (ptr, ostree_sign_dummy_get_type ()); }
+
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+/* Have to use glib-2.44 for this
 _OSTREE_PUBLIC
 G_DECLARE_FINAL_TYPE (OstreeSignDummy,
                       ostree_sign_dummy,
                       OSTREE,
                       SIGN_DUMMY,
                       GObject)
+*/
 
 const gchar * ostree_sign_dummy_get_name (OstreeSign *self);
 
index 0c7cd9513cd5d5dfeca0364fb7ccd19e83e3e53e..2d5bdb16efbd773f5b705e5fdf8d18bf446ba656 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "config.h"
 
+#include <libglnx.h>
 #include "ostree-sign-ed25519.h"
 #ifdef HAVE_LIBSODIUM
 #include <sodium.h>
@@ -47,6 +48,10 @@ struct _OstreeSignEd25519
   GList *revoked_keys;
 };
 
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeSignEd25519, g_object_unref)
+#endif
+
 static void
 ostree_sign_ed25519_iface_init (OstreeSignInterface *self);
 
index bced1cdfc8e17ea4e0ebda270ffb01a32ef2b5b4..6e5dd6657cd6c37ae10043f9bff3e9376f07afdf 100644 (file)
@@ -32,13 +32,26 @@ G_BEGIN_DECLS
 
 #define OSTREE_TYPE_SIGN_ED25519 (ostree_sign_ed25519_get_type ())
 
+_OSTREE_PUBLIC
+GType ostree_sign_ed25519_get_type (void);
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+typedef struct _OstreeSignEd25519 OstreeSignEd25519;
+typedef struct { GObjectClass parent_class; } OstreeSignEd25519Class;
+
+static inline OstreeSignEd25519 *OSTREE_SIGN_ED25519 (gpointer ptr) { return G_TYPE_CHECK_INSTANCE_CAST (ptr, ostree_sign_ed25519_get_type (), OstreeSignEd25519); }
+static inline gboolean OSTREE_IS_SIGN_ED25519 (gpointer ptr) { return G_TYPE_CHECK_INSTANCE_TYPE (ptr, ostree_sign_ed25519_get_type ()); }
+
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+/* Have to use glib-2.44 for this
 _OSTREE_PUBLIC
 G_DECLARE_FINAL_TYPE (OstreeSignEd25519,
                       ostree_sign_ed25519,
                       OSTREE,
                       SIGN_ED25519,
                       GObject)
-
+*/
 
 gboolean ostree_sign_ed25519_data (OstreeSign *self,
                                    GBytes *data,
index 95319f676b7865d3e90bf10ba6281d16b6f3bbcd..75db0b26a2e22e5d92d161de6adc5e5e06ab88f7 100644 (file)
@@ -47,6 +47,8 @@
 #include "ostree-sign-ed25519.h"
 #endif
 
+#include "ostree-autocleanups.h"
+
 #undef G_LOG_DOMAIN
 #define G_LOG_DOMAIN "OSTreeSign"
 
index 87ed25cee81e0bc53681ff7c397be9462d453c7b..1415becb6c25613e356d3117d8e9719bd855a379 100644 (file)
 #include "ostree-remote.h"
 #include "ostree-types.h"
 
-/* Special remote */
-#define OSTREE_SIGN_ALL_REMOTES "__OSTREE_ALL_REMOTES__"
-
-
 G_BEGIN_DECLS
 
 #define OSTREE_TYPE_SIGN (ostree_sign_get_type ())
 
+_OSTREE_PUBLIC
+GType ostree_sign_get_type (void);
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+typedef struct _OstreeSign OstreeSign;
+typedef struct _OstreeSignInterface OstreeSignInterface;
+
+static inline OstreeSign *OSTREE_SIGN (gpointer ptr) { return G_TYPE_CHECK_INSTANCE_CAST (ptr, ostree_sign_get_type (), OstreeSign); }
+static inline gboolean OSTREE_IS_SIGN (gpointer ptr) { return G_TYPE_CHECK_INSTANCE_TYPE (ptr, ostree_sign_get_type ()); }
+static inline OstreeSignInterface *OSTREE_SIGN_GET_IFACE (gpointer ptr) { return G_TYPE_INSTANCE_GET_INTERFACE (ptr, ostree_sign_get_type (), OstreeSignInterface); }
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+/* Have to use glib-2.44 for this
 _OSTREE_PUBLIC
 G_DECLARE_INTERFACE (OstreeSign, ostree_sign, OSTREE, SIGN, GObject)
+*/
 
 struct _OstreeSignInterface
 {
index 49ca919c7f8d33f874b13fa7ecedf3ada165667b..0308d0ed91f33f194400cfa83b32cc3684d9e33f 100644 (file)
@@ -40,5 +40,6 @@
 #include <ostree-repo-finder-mount.h>
 #include <ostree-repo-finder-override.h>
 #include <ostree-kernel-args.h>
+#include <ostree-sign.h>
 #include <ostree-autocleanups.h>
 #include <ostree-version.h>